<template>
	<view class="ff-window">
		<view class="ff-background">
			<image class="ff-background-image" mode="aspectFill"
				src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/cat-1.png"></image>
		</view>
		<view class="ff-mask"></view>
		<view class="ff-container">
			<view class="ff-header">
				<view class="ff-header-safe-area"></view>
				<view class="ff-header-content">
					<slot name="header">
						<view class="ff-header-left">
							<slot name="header-left">
							</slot>
						</view>
						<view class="ff-header-center">
							<slot name="header-center">
								<view class="ff-header-title">
									{{ title }}
								</view>
							</slot>
						</view>
						<view class="ff-header-right">
							<slot name="header-right">
							</slot>
						</view>
					</slot>
				</view>
			</view>
			<view class="ff-sticky">
				<slot name="sticky"></slot>
			</view>
			<view class="ff-notifications">
				<slot name="notifications"></slot>
			</view>
			<view class="ff-main">
				<slot name="main">
					<scroll-view class="ff-scroll" :scroll-y="true" :scroll-x="true">
						<slot name="default"></slot>
					</scroll-view>
				</slot>
			</view>
			<view class="ff-popup">
				<slot name="popup"></slot>
			</view>
			<view class="ff-footer">
				<slot name="footer"></slot>
			</view>
		</view>
	</view>
</template>
<script>
import pages from '../../../../pages.json'
export default {
	name: "ff-window",
	options: {
		virtualHost: true
	},
	emits: ["update:modelValue", "input", "change"],
	props: {
		name: {
			type: [String],
			default: undefined,
		},
		title: {
			type: String,
			default: undefined,
		},
	},
	data() {
		return {

		}
	},
	computed: {

	},
	mounted() {
		const systemInfo = uni.getSystemInfoSync();
		console.log('状态栏高度:', systemInfo.statusBarHeight); // 单位 px
		console.log('胶囊按钮布局:', systemInfo.menuButtonBoundingClientRect);
		console.log('窗口可使用高度:', systemInfo.windowHeight);
		console.log('窗口可使用高度:', systemInfo);
	},
	// #ifdef VUE2
	destroyed() {

	},
	// #endif
	// #ifdef VUE3
	unmounted() {

	},
	// #endif
	methods: {

	},
}
</script>
<style scoped>
.ff-window {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1000;
}

.ff-background {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	z-index: -1;
}

.ff-background-image {
	width: 100%;
	height: 100%;
}

.ff-mask {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.6);
	display: none;
}

.ff-container {
	position: relative;
	/* background: #ffffff; */
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	width: 100%;
	max-width: none;
	z-index: 1;
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.ff-header {
	display: block;
	width: 100%;
	/* border-bottom: 1px solid #e0e0e0; */
	/* background-color: #ffffff; */
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ff-header-safe-area {
	width: 100%;
	height: var(--status-bar-height);
	padding-top: env(safe-area-inset-top);
	margin-top: calc(var(--window-top));
}

.ff-header-content {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	width: 100%;
	min-height: 75px;
	/* padding: 20rpx 30rpx; */
}

.ff-header-left {
	display: flex;
	align-items: center;
	justify-self: start;
}

.ff-header-center {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 500;
	font-size: 16px;
	min-width: 0;
}

.ff-header-right {
	display: flex;
	align-items: center;
	justify-self: end;
}

.ff-sticky {
	flex-shrink: 0;
}

.ff-notifications {
	display: none;
	flex-shrink: 0;
	padding: 10px 15px;
	border-bottom: 1px solid #eee;
	/* background-color: #f9f9f9; */
}

.ff-main {
	flex: 1;
	overflow-y: auto;
	min-height: 100px;
	/* background-color: #f5f5f5; */
}

.ff-scroll {
	height: 100%;
	width: 100%;
	overflow-y: auto;
	overflow-x: hidden;
}

.ff-popup {
	flex-shrink: 0;
}

.ff-footer {
	display: none;
	padding: 15px 20px;
	border-top: 1px solid #f0f0f0;
	text-align: right;
	flex-shrink: 0;
}
</style>